
<script setup>
	import { computed, ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { store } from '@/uni_modules/uni-id-pages/common/store.js'
	
	const list = ref([])
	const info = computed(() => store.userInfo)
	const db = uniCloud.database()
	onLoad(() => {
		getList()
	})
	
	const getList = async () => {
		const res = await db.collection('dynamic_list').where({userId:info.value._id}).orderBy('createTime desc').get()
		const { data } = res.result
		if(!data.length) return
		const newArr = data.map(item => item.image)
		list.value = newArr.flat()
	}
	
	const previewImage = (urls,current) => {
		uni.previewImage({
			urls,current
		})
	}
</script>

<template>
	<view class="lsit">
		<image v-for="(item,index) in list" :key="index" :src="item" mode="widthFix" @click="previewImage(list,index)"></image>
	</view>
</template>

<style lang="scss" scoped>
	.lsit{
		padding-bottom: 20rpx;
	}
	image{
		width: 100%;
	}
</style>